﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace Delay
{
    public class PhoneInfoCenterItem : INotifyPropertyChanged
    {
        private bool _isTaped;
        public bool IsTaped
        {
            get
            {
                return _isTaped;
            }
            set
            {
                if (_isTaped != value)
                {
                    _isTaped = value;
                    NotifyPropertyChanged("IsTaped");
                }
            }
        }
        private string _title;
        public string Title
        {
            get
            {
                return _title;
            }
            set
            {
                if (_title != value)
                {
                    _title = value;
                    NotifyPropertyChanged("Title");
                }
            }
        }
        private string _content;
        public string Content
        {
            get
            {
                if (_content != null && _content.Length > 0)
                {
                     _content = _content.Replace( "<br/>","\n").Replace( "<br />","\n");
                     _content=HttpUtility.HtmlDecode(_content);
                     return _content;
                }
                else
                    return _content;
            }
            set
            {
                if (_content != value)
                {
                    _content = value;
                    NotifyPropertyChanged("Content");
                }
            }
        }
        private string _picurl;
        public string Picurl
        {
            get
            {
                return _picurl;
            }
            set
            {
                if (_picurl != value)
                {
                    _picurl = value;
                    NotifyPropertyChanged("Picurl");
                }
            }
        }
        private string _type;
        public string Type
        {
            get
            {
                return _type;
            }
            set
            {
                if (_type != value)
                {
                    _type = value;
                    NotifyPropertyChanged("Type");
                }
            }
        }
        //前面这些项是本级Ui用的
        //下面的这些自动属性石下一级UI用的，即点击回复的时候用的
        private string _keywords;
        public string Keywords
        {
            get
            {
                return _keywords;
            }
            set
            {
                if (_keywords != value)
                {
                    _keywords = value;
                    NotifyPropertyChanged("Keywords");
                }
            }
        }
        private string _writetime;
        public string Writetime
        {
            get
            {
                return _writetime;
            }
            set
            {
                if (_writetime != value)
                {
                    _writetime = value;
                    if (_writetime.IndexOf("￥") <= -1) _writetime = "￥" + _writetime;
                    NotifyPropertyChanged("Writetime");
                }
            }
        }
        private string _replytime;
        public string Replytime
        {
            get
            {
                return _replytime;
            }
            set
            {
                if (_replytime != value)
                {
                    _replytime = value;
                    NotifyPropertyChanged("Replytime");
                }
            }
        }
        //这几个需要从属性中读出，不是从节点中读出
        private string _ztid;
        public string Ztid
        {
           get
            {
                return _ztid;
            }
            set
            {
                if (_ztid != value)
                {
                    _ztid = value;
                    NotifyPropertyChanged("Ztid");
                }
            }
        }
        public string _readcount;
        public string Readcount
        {
            get
            {
                return _readcount;
            }
            set
            {
                if (_readcount != value)
                {
                    _readcount = value;
                    NotifyPropertyChanged("Readcount");
                }
            }
        }
        private string _replycount;
        public string Replycount
        {
            get
            {
                return _replycount;
            }
            set
            {
                if (_replycount != value)
                {
                    _replycount = value;
                    NotifyPropertyChanged("Replycount");
                }
            }
        }
        private string _userid;
        public string Userid
        {
            get
            {
                return _userid;
            }
            set
            {
                if (_userid != value)
                {
                    _userid = value;
                    NotifyPropertyChanged("Userid");
                }
            }
        }
        private string _topid;
        public string Topicid
        {
            get
            {
                return _topid;
            }
            set
            {
                if (_topid != value)
                {
                    _topid = value;
                    NotifyPropertyChanged("Topicid");
                }
            }
        }           
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
